package cn.lblbc.downloadlib;

/**
 * 下载分片信息
 */
public class DownloadChunk {
    private long chunkId;
    private long fileId;
    private long startPos;
    private long endPos;
    private long downloadedSize;
    private long createTime;
    private long updateTime;

    public DownloadChunk() {
    }

    public long getChunkId() {
        return chunkId;
    }

    public void setChunkId(long chunkId) {
        this.chunkId = chunkId;
    }

    public long getFileId() {
        return fileId;
    }

    public void setFileId(long fileId) {
        this.fileId = fileId;
    }

    public long getStartPos() {
        return startPos;
    }

    public void setStartPos(long startPos) {
        this.startPos = startPos;
    }

    public long getEndPos() {
        return endPos;
    }

    public void setEndPos(long endPos) {
        this.endPos = endPos;
    }

    public long getDownloadedSize() {
        return downloadedSize;
    }

    public void setDownloadedSize(long downloadedSize) {
        this.downloadedSize = downloadedSize;
    }

    public long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(long createTime) {
        this.createTime = createTime;
    }

    public long getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(long updateTime) {
        this.updateTime = updateTime;
    }

    /**
     * 判断分片是否已完成
     * @return true表示已完成，false表示未完成
     */
    public boolean isCompleted() {
        return downloadedSize >= (endPos - startPos + 1);
    }
}